package com.ruiyian.bridge.project.service.impl;

import com.ruiyian.bridge.project.domain.DeviceWarnSet;
import com.ruiyian.bridge.project.mapper.DeviceWarnSetMapper;
import com.ruiyian.bridge.project.service.DeviceWarnSetService;
import com.ruiyian.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * 超限预警设置Service业务层处理
 *
 * @author ruiyian
 * @date 2022-01-19
 */
@Service
public class DeviceWarnSetServiceImpl implements DeviceWarnSetService
{
    @Autowired
    private DeviceWarnSetMapper deviceWarnSetMapper;

    /**
     * 查询超限预警设置
     *
     * @param id 超限预警设置主键
     * @return 超限预警设置
     */
    @Override
    public DeviceWarnSet selectTSensorWarnSetById(Long id)
    {
        return deviceWarnSetMapper.selectTSensorWarnSetById(id);
    }

    /**
     * 查询超限预警设置列表
     *
     * @param deviceWarnSet 超限预警设置
     * @return 超限预警设置
     */
    @Override
    public List<DeviceWarnSet> selectTSensorWarnSetList(DeviceWarnSet deviceWarnSet)
    {
        return deviceWarnSetMapper.selectTSensorWarnSetList(deviceWarnSet);
    }

    /**
     * 新增超限预警设置
     *
     * @param deviceWarnSet 超限预警设置
     * @return 结果
     */
    @Override
    public int insertTSensorWarnSet(DeviceWarnSet deviceWarnSet)
    {
        deviceWarnSet.setCreateTime(DateUtils.getNowDate());
        return deviceWarnSetMapper.insertTSensorWarnSet(deviceWarnSet);
    }

    /**
     * 修改超限预警设置
     *
     * @param deviceWarnSet 超限预警设置
     * @return 结果
     */
    @Override
    public int updateTSensorWarnSet(DeviceWarnSet deviceWarnSet)
    {
        deviceWarnSet.setUpdateTime(DateUtils.getNowDate());
        return deviceWarnSetMapper.updateTSensorWarnSet(deviceWarnSet);
    }

    /**
     * 批量删除超限预警设置
     *
     * @param ids 需要删除的超限预警设置主键
     * @return 结果
     */
    @Override
    public int deleteTSensorWarnSetByIds(Long[] ids)
    {
        return deviceWarnSetMapper.deleteTSensorWarnSetByIds(ids);
    }

    /**
     * 删除超限预警设置信息
     *
     * @param id 超限预警设置主键
     * @return 结果
     */
    @Override
    public int deleteTSensorWarnSetById(Long id)
    {
        return deviceWarnSetMapper.deleteTSensorWarnSetById(id);
    }
}
